<template>
  <div style="background: #ffffff">
    <div class="app-container" style="background: #ffffff;  ">
      <!-- <div style="background: #ebeff4">
    <div class="app-container" style="background: #ebeff4;margin:10px; "> -->
      <div style="font-weight: bold;"><a @click="morelist" style="color:#898e99;">H合同列表</a> / 订单合同</div>
      <el-form ref="form2" :model="form2" :rules="rulesht" label-width="110px">
        <el-row :gutter="20" style="margin-top: 10px;" v-loading="loading">
          <el-col :span="24">
            <el-card class="update-log">
              <el-row :gutter="10" class="mb8">
                <el-col :span="4">
                  <h5 style="font-size: 14px; color: #252B3A; font-weight: 700;margin-top: 0px;margin-bottom: 20px;">
                    客户信息</h5>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="6">
                  <el-form-item label="合同日期" prop="agrDate">
                    <el-date-picker v-model="form2.agrDate" value-format="yyyy-MM-dd" style="width:90%" type="date"
                      @change="changedate($event)" placeholder="选择日期" readonly>
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="合同编号" prop="agrId">
                    <el-input style="width:90%" v-model="form2.agrId" placeholder="请输入合同编号" clearable disabled />
                  </el-form-item>
                </el-col>

                <el-col :span="6">
                  <el-form-item label="商机来源" prop="agrSjly">
                    <el-select placeholder="商机来源" style="width:90%" v-model="form2.agrSjly" clearable disabled>
                      <el-option v-for="dict in dict.type.ht_sjly" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                    </el-select>
                  </el-form-item>

                </el-col>
                <el-col :span="6">
                  <el-form-item label="客户名称" prop="khname">
                    <el-input v-model="form2.khname" clearable placeholder="客户名称" @focus="showkh()" readonly>
                      <i slot="suffix" class="el-icon-document-copy ckh" :data-clipboard-text="form2.khname"
                        style="cursor:pointer ;" @click="copy('.ckh')"></i>
                    </el-input>
                  </el-form-item>

                </el-col>
              </el-row>
              <el-row>
                <el-col :span="6">
                  <el-form-item label="客户打款抬头" prop="agrDktt">
                    <el-input style="width:90%" v-model="form2.agrDktt" clearable placeholder="客户打款抬头" readonly>
                      <i slot="suffix" class="el-icon-camera" style="cursor:pointer ;" @click="copyfd"></i>
                    </el-input>

                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="我方收款抬头" prop="agrSkzh">
                    <el-select style="width:90%" v-model="form2.agrSkzh" clearable placeholder="我方收款抬头" disabled>
                      <el-option v-for="dict in dict.type.ht_skzh" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="关联渠道" prop="gsname">
                    <!-- <el-select v-model="form2.deaId" style="width: 90%;" filterable placeholder="请选择归属渠道">
                        <el-option v-for="item in deaOptionsa" :key="item.deaId" :label="item.deaName"
                          :value="item.deaId"></el-option>
                      </el-select> -->
                    <el-input v-model="form2.gsname" style="width:90%" clearable placeholder="关联渠道" readonly
                      @focus="showsjqd(2)">
                      <i slot="suffix" class="el-icon-document-copy cgsqd" :data-clipboard-text="form2.gsname"
                        style="cursor:pointer ;" @click="copy('.cgsqd')"></i>
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="实际渠道" prop="sjname">
                    <el-input v-model="form2.sjname" clearable placeholder="实际渠道" @focus="showsjqd(1)" readonly>
                      <i slot="suffix" class="el-icon-document-copy csjqd" :data-clipboard-text="form2.sjname"
                        style="cursor:pointer ;" @click="copy('.csjqd')"></i>
                      <!-- <el-select v-model="form2.realDea" style="width: 90%;" filterable placeholder="请选择实际渠道"
                       >
                        <el-option v-for="item in deaOptions" :key="item.deaId" :label="item.deaName"
                          :value="item.deaId"></el-option>
                      </el-select> -->
                    </el-input>
                  </el-form-item>
                </el-col>


              </el-row>
              <el-row>

                <el-col :span="6">
                  <el-form-item label="下单模式" prop="agrXdms">
                    <el-select placeholder="下单模式" style="width:90%" v-model="form2.agrXdms" clearable disabled>
                      <el-option v-for="dict in dict.type.ht_xdms" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="订单类型" prop="agrDdlx">
                    <el-select placeholder="订单类型" style="width:90%" v-model="form2.agrDdlx" clearable disabled>
                      <el-option v-for="dict in dict.type.ht_ddlx" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="订单周期" prop="agrDdzq">
                    <el-select placeholder="订单周期" style="width:90%" v-model="form2.agrDdzq" clearable disabled>
                      <el-option v-for="dict in dict.type.ht_ddzq" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="是否新客" prop="agrSfxk">
                    <el-select placeholder="是否新客" style="width:100%" v-model="form2.agrSfxk" clearable disabled>
                      <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label="备注" prop="mark">
                    <el-input v-model="form2.mark" type="textarea" placeholder="请输入备注" readonly />
                  </el-form-item>
                </el-col>

              </el-row>
            </el-card>
          </el-col>
        </el-row>
        <el-row :gutter="20" style="margin-top: 10px;">
          <el-col :span="24">
            <el-card class="update-log">
              <el-tabs v-model="activeName" @tab-click="tbClick">
                <el-tab-pane label="订单管理" name="first">
                  <el-row :gutter="10" class="mb8">
                    <el-col>
                      <el-table :data="customerorderListItem" height="300px" border="" v-loading="loading1"
                        :header-cell-style="{ background: '#eef1f6', color: '#606266' }">
                        <el-table-column label="订单号" align="center" prop="orderId" width="180">
                          <template slot-scope="scope">
                            <div style="color: cornflowerblue;">{{
                              scope.row.orderId }}</div>
                          </template>
                        </el-table-column>
                        <el-table-column label="客户帐号id" align="center" prop="customerId" v-if="false" />
                        <el-table-column label="云服务类型编码" align="center" prop="serviceTypeCode" v-if="false" />
                        <el-table-column label="产品类型" align="center" prop="serviceTypeName" />
                        <el-table-column label="订单类型" align="center" prop="orderType">
                          <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_order_type" :value="scope.row.orderType" />
                          </template>
                        </el-table-column>
                        <el-table-column label="订单状态" align="center" prop="status">
                          <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_order_state" :value="scope.row.status" />
                          </template>
                        </el-table-column>
                        <el-table-column label="客户名称/帐号" align="left" prop="userName" width="220">
                          <template slot-scope="scope">
                            <el-tooltip placement="top">
                              <div slot="content">{{ scope.row.customer }}<br />{{ scope.row.accountName }}</div>
                              <div>
                                <div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">{{
                                  scope.row.customer
                                  }}
                                </div>
                                <div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
                                  {{ scope.row.accountName }}
                                </div>
                              </div>
                            </el-tooltip>
                          </template>
                        </el-table-column>
                        <el-table-column label="订单金额" align="right" prop="officialAmount">
                          <template slot-scope="scope">
                            {{ toFixed(scope.row.officialAmount) }}
                          </template>
                        </el-table-column>
                        <!-- <el-table-column label="实付金额" align="right" prop="amountAfterDiscount">
                          <template slot-scope="scope">
                            {{ toFixed(scope.row.amountAfterDiscount) }}
                          </template>
                        </el-table-column>
                        <el-table-column label="返点比例" align="center" prop="applx" width="100">
                          <template slot-scope="scope">
                            <el-select placeholder="返点比例" style="width:90%" v-model="scope.row.jeFd" clearable>
                              <el-option v-for="dict in dict.type.sys_order_fdbl" :key="dict.value" :label="dict.label"
                                :value="dict.value" />
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column label="订单订单来源类型" align="center" prop="sourceType" v-if="false" />
                        <el-table-column label="下单时间" align="center" prop="createTime1" v-if="false">
                          <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.createTime1, '{y}-{m}-{d} {hh}:{mm}') }}</span>
                          </template>
                        </el-table-column> -->
                        <el-table-column label="支付时间" align="center" prop="paymentTime" width="100">
                          <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.paymentTime, '{y}-{m}-{d}') }}</span>

                          </template>
                        </el-table-column>

                        <el-table-column label="关联渠道" align="left" prop="deaname">
                          <template slot-scope="scope">
                            <div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"
                              :title="scope.row.deaname">
                              {{ scope.row.deaname }}</div>
                          </template>
                        </el-table-column>

                        <!-- <el-table-column label="实际渠道" align="left">
                          <template slot-scope="scope">
                            <div :title="scope.row.realDeaName"
                              style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"> {{
                                scope.row.realDeaName }}
                            </div>
                          </template>
                        </el-table-column>

                        <el-table-column label="返点金额" align="center" prop="jeFdsj" v-if="false">
                          <template slot-scope="scope">
                            {{ toFixed(scope.row.jeFdsj) }}
                          </template>
                        </el-table-column>
                        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140px">
                          <template slot-scope="scope">
                            <el-button size="mini" type="text" icon="el-icon-connection"
                              @click="xqtc(scope.row)">详情</el-button>
                            <el-button size="mini" type="text" icon="el-icon-edit"
                              @click="handleDelete(scope.$index, scope.row)">移除</el-button>

                          </template>
                        </el-table-column> -->
                      </el-table>
                    </el-col>

                  </el-row>
                </el-tab-pane>
              </el-tabs>
              <el-row style="margin-top: 20px;">
                <el-col :span="16">1</el-col>
                <el-col :span="4">
                  <div style="float: right;color:red ;margin-top: 3px;"> {{ddmoney}}</div>
                  <div style="float: right;"> 订单总金额：</div>
                </el-col>
                <el-col :span="4">
                  <div style="float: right;color: #0048ff;margin-top: 3px;"> {{form2.outmoney}}</div>
                  <div style="float: right;"> 分润金额：</div>
                </el-col>

              </el-row>
            </el-card>
          </el-col>
        </el-row>
      </el-form>
    </div>

  </div>
</template>

<script>
  import { listPayConItem } from "@/api/payment/PayContract";
  import { listbkitem } from "@/api/BankdetailsMain/bankdetails";
  import { listAdjust, listAdjustAll, listAdjustItem, updateAdjust } from "@/api/AdjustMain/adjust";
  import { listCustomerinfo } from "@/api/CustomerinfoMain/customerinfo";
  import { tblistCustomerorder, listCustomerorder1, ImportCustomerorder, listCustomerorderAll, listOrderItem2, getCustomerorder, delCustomerorder, addCustomerorder, updateCustomerorder, insertxq, listCustomerorderItem, selectywy, updateqdc } from "@/api/CustomerorderMain/customerorder";
  import { listDealerAll, addDealersj, } from "@/api/DealerMain/dealer";
  import { listAgreement, getAgreement, delAgreement, addAgreement, updateAgreement, Htcode, getAgreement2 } from "@/api/AgreementMain/agreement";
  import { getUserProfile, listuser, listJsy, listuser2 } from "@/api/system/user";
  import { done, TimeDate, GetMonA, GetMonB } from "@/api/public";
  import { listAgreementmoney } from "@/api/Agreementmoney/Agreementmoney"
  import { listCost } from "@/api/cost/cost";
  import orderxx from '@/views/Mycomponents/OrderMain/orderxx';
  import ClipboardJS from 'clipboard';

  export default {
    dicts: ["sys_order_type", "sys_order_state", "ht_ddlx", "ht_skzh", "ht_xdms", "sys_yes_no", "ht_sjly", "ht_ddzq", "dea_type", "tzlx", "tz_type", "sys_order_fdbl", 'cost_pay_type', 'cost_type', "ht_skzh", "bank_type", "agreement_power"],
    name: "Agreement",
    components: {
      orderxx
    },
    data() {
      return {
        ddmoney: "0.00",
        //合作相关
        inuser: [],
        outuser: [],

        allfdbl: null,
        btype: null,//判断是否为添加虚拟合同进
        activeName: 'first',
        deaType: null, //实际渠道值 个人 企业
        zfjeshow: "0.00", //订单金额计算
        tzjeshow: "0.00", //调帐金额计算
        zgfdshow: "0.00",  //暂估返点计算
        fkjeshow: "0.00",  //返客金额
        fqjeshow: "0.00",  //返渠金额
        bkjeshow: "0.00",//银行打款金额
        bkdjce: "0.00",//打款差额

        atype: null, //进页面时的类型，1表示添加，2修改

        ys: 0,//跳转过来的页数，用于加去时加载到对应页

        // 遮罩层
        loading: true,
        //关联订单
        loading1: true,
        //关联调帐
        loading3: true,


        //下拉对应参数
        deaOptionsa: [],
        jsyOption: [],//技术员
        BkOptions: [], //拨款人
        ywyOptions: [],//业务员
        XdOptions: [], //拨款人
        sh1Options: [],//审核人 1
        sh2Options: [], //审核人2

        // 费用管理表格数据-----------------
        costList: [],
        queryParamscost: {
          pageNum: 1,
          pageSize: 10,
          costContract: null,
        },

        //渠道客户对应的渠道-查询参数
        queryParamsdea: {
          pageNum: 1,
          pageSize: 9999,
          dtype: 2,
        },

        //订单数据弹窗选择相关-----------------------
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        openxq: false,
        deaval: {
          //分配时，传值的parm
          orderId: null,
          indirectPartnerId: null,
        },

        titleord: "",
        openord: false,
        // 总条数
        totalord: 0,
        dateRange: [],//订单时间过滤
        dateRangetz: [], //调帐时间过滤
        // 查询参数
        queryParamsord: {
          pageNum: 1,
          pageSize: 20,
          orderId: null,
          customer: null,
          customerId: null,
          serviceTypeCode: null,
          sourceType: null,
          status: null,
          orderType: null,
          amountAfterDiscount: null,
          officialAmount: null,
          measureId: null,
          paymentTime: null,
          currency: null,
          contractId: null,
          amountInfo: null,
          orderInfo: null,
          orderLineItems: null,
          userName: null,
          other1: null,
          other2: null,
          other3: null,
          other4: null,
          other5: null,
          ordselid: [],
        },
        customerorderListord: [],//选择订单弹窗数据列表
        //用于保存返点比例到订单表
        ddform: {},
        customerorderListItem: [],//选中后的订单列表数据，对应合同订单加载

        //合同实体类加载，这边不写会导致mod数据修改时不刷新，因为没有写restform赋值方法所以直接写这里了--------------------
        form2: {
          jeDk: null,
          jeBk: null,
          sfje: null,
          jeFk: null,
          jeFq: null,
          jeFdsj: null,
          jeFd: null,
          jejFdsj: null,
          jejFd: null,
          jeLrsj: null,
          jeLr: null,
          agrId: null,
          agrDate: null,
          deaId: null,
          realDea: null,
          customerId: null,
          customerIdHw: null,
          userId: null,
          ywyName: null,
          jsuserId: null,
          xduserId: null,
          bkuserId: null,

          agrDktt: null,
          agrDdzq: null,
          agrSkzh: null,
          agrSjly: null,
          agrXdms: null,
          agrDdlx: null,
          agrSfxk: null,
          orderIdItem: null, //获取数据显示到数组
          tzIdItem: null,

          gsname: null,//关联渠道
          sjname: null,//实际渠道
          khname: null,//客户员名称

          ordselid: [], //后台接收保存数据
          tzselid: [],
          qxList: [],
        },
        //合同信息校验
        rulesht: {
          agrDate: [
            { required: true, message: "合同日期不能为空" },
          ],
          agrSjly: [
            { required: true, message: "商机来源不能为空" },
          ],
          agrDktt: [
            { required: true, message: "打款抬头不能为空" },
          ],
          agrSkzh: [
            { required: true, message: "收款帐号不能为空" },
          ],
          agrXdms: [
            { required: true, message: "下单模式不能为空" },
          ],
          agrDdlx: [
            { required: true, message: "订单类型不能为空" },
          ],
          agrDdzq: [
            { required: true, message: "订单周期不能为空" },
          ],
          agrSfxk: [
            { required: true, message: "是否新客不能为空" },
          ],
          khname: [
            { required: true, message: "客户名称不能为空" },
          ],
          sjname: [
            { required: true, message: "实际渠道不能为空" },
          ],
          gsname: [
            { required: true, message: "关联渠道不能为空" },
          ],
        },
        //查看权限
        queryqx: {
          htId: null,
        },
        qxList: [],
        titleqx: "",
        openqx: false,
        ywyOptions: [],//业务员
        qxform: {
          userId: null,
          moneyPro: null,
          moneyNumber: null,
          userType: null,
        },
        selectuserid: "",
        selectusername: "",
        checklist: [{ value: "A", label: "订单管理" }, { value: "B", label: "拨款管理" }, { value: "C", label: "流程费用" }, { value: "D", label: "银行明细" }],

        //分配客户相关--------------------
        openkh: false,
        titlekh: "",
        khList: [],
        totalkh: 0,
        khid: [],
        khmc: [],
        // 查询参数
        queryParamsKh: {
          pageNum: 1,
          pageSize: 10,
          customer: null,
          verifiedStatus: 2,
        },

        //流程付款数据------------------
        // 付款申请表格数据
        PaymentList: [],
        queryParamsLc: {
          pageNum: 1,
          pageSize: 100,
          htId: null,
        },

        //实际渠道相关------------------
        title: "",
        open: false,
        //渠道添加弹窗时，隐藏显示
        sjbtshow: false,
        gsbtshow: false,
        //分配渠道相关
        openqd: false,
        titleqd: "",
        dealerList: [],
        deid: [],//分配选中的渠道
        dename: [],

        realDea: [], //实际渠道-选择客户时，赋值
        sjname: [], //实际名称-选择客户时，赋值

        qdval: {//分配时，传值的parm
          realDea: null,
          orderId: null,
        },
        totalqd: 0,
        // 查询参数
        queryParamsQd: {
          pageNum: 1,
          pageSize: 10,
          Dtype: 2,
          accountIn: null,
          deaName: null,
        },
        // 实际渠道表单参数
        form: {
        },

        //实际渠道校验
        rules: {
          deaName: [
            { required: true, message: "渠道名称不能为空", trigger: "blur" },
          ],
          deaUser: [
            { required: true, message: "用户名不能为空", trigger: "blur" },
          ],
          deaCode: [
            { required: true, message: "渠道编码不能为空", trigger: "blur" },
          ],
          deaPeople: [
            { required: true, message: "联系人不能为空", trigger: "blur" },
          ],
          // deaPassword: [
          //   { required: true, message: "用户密码不能为空", trigger: "blur" },
          //   {
          //     min: 5,
          //     max: 20,
          //     message: "用户密码长度必须介于 5 和 20 之间",
          //     trigger: "blur",
          //   },
          // ],
          deaEmail: [
            {
              type: "email",
              message: "请输入正确的邮箱地址",
              trigger: ["blur", "change"],
            },
          ],
          deaTel: [
            { required: true, message: "手机号不能为空", trigger: "blur" },
            {
              pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
              message: "请输入正确的手机号码",
              trigger: "blur",
            },
          ],
        },

        //调帐记录相关-------------------------
        //用于保存调账备份和类型
        tzform: {},
        tzListItem: [],//选中后的调帐列表数据
        opentz: false,
        titletz: "",
        tzList: [],
        tzid: [],//分配选中的渠道
        totaltz: 0,
        // 查询参数
        queryParamsTz: {
          pageNum: 1,
          pageSize: 10,
          other1: null,
          tzdselid: [],
        },

        //银行明细查询参数-------------------------
        bkList: [],
        queryParamsBk: {
          pageNum: 1,
          pageSize: 30,
          agrid: null,
        },

        //下一条上一条查询对比
        searchparms: {
        },
        searchhtlist: [],
        searchdateRange: [],
        btntop: false,
        btnnext: false,


      };
    },

    created() {
      //进来时，加载初始数据
      if (this.$route.query.atype != undefined) {
        this.ys = this.$route.query.ys;
        this.queryqx.htId = this.$route.query.aid;

        //查看合同
        getAgreement2(this.$route.query.aid).then(response => {

          this.loading = false;


          this.bkjeshow = "0.00";

          this.form2 = response.data;
          this.atype = 2;
          //绑定订单列表
          if (this.form2.orderIdItem != null && this.form2.orderIdItem != "") {
            let oitemid = this.form2.orderIdItem.split(','); //根据iditemid来绑定列表数据显示
            this.queryParamsord.ordselid = oitemid;
            this.loading1 = false;
            this.ImportClick();
          }
          else
            this.loading1 = false;

        });

      }
      else {
        alert("访问异常");
        this.morelist();
        return;
      }

      this.dateRange[0] = GetMonA(3);
      this.dateRange[1] = GetMonB();
      this.dateRangetz[0] = "2023-01-01";//先暂定1月1

      this.dateRangetz[1] = GetMonB();



    },
    methods: {
      toFixed(num) {
        return (Math.round(num * 100) / 100).toFixed(2);
      },
      //复制返点金额
      copyfd() {
        this.form2.agrDktt = this.form2.sjname;
      },
      tbClick(tab, event) {
        //console.log(tab, event);
      },
      morelist() {
        this.$router.push(
          {
            path: '/htxg/agreement2',
            methods: 'post',
            query: {
              ys: this.ys,
            }
          })
      },
      ImportClick(row) {

        //判断是否选择了订单
        const eee = this.queryParamsord.ordselid; //选中的订单
        if (eee.length < 1) {
          this.$modal.msgWarning("请至少选择一条数据");

          return;
        }

        //这两个一样，忘记为什么要写这样了？
        if (this.atype == 2) {
          listOrderItem2(this.queryParamsord).then(response => {
            if (this.customerorderListItem.length > 0) {
              response.rows.forEach(el1 => {
                this.customerorderListItem.push(el1);
              });
            }
            else
              this.customerorderListItem = response.rows;

            //数组对象去重
            let uniqueDataList = this.customerorderListItem.filter((item, index, self) => {
              // 返回第一个匹配项的索引，用于判断当前项是否为第一个匹配项
              const firstIndex = self.findIndex((obj) => obj.orderId === item.orderId);
              // 如果当前项是第一个匹配项，则保留，否则过滤掉
              return index === firstIndex;
            });
            this.customerorderListItem = uniqueDataList;

            // this.loading = false;
            this.loading1 = false;
            this.openord = false;

            let num = 0;
            //计算订单总金额
            this.customerorderListItem.forEach(item => {
              num += parseFloat(item.officialAmount) ;
            });
            this.ddmoney = num.toFixed(2);
          });
        }
        else {
          listOrderItem2(this.queryParamsord).then(response => {
            if (this.customerorderListItem.length > 0) {
              response.rows.forEach(el1 => {
                this.customerorderListItem.push(el1);
              });
            }
            else
              this.customerorderListItem = response.rows;

            //数组对象去重
            let uniqueDataList = this.customerorderListItem.filter((item, index, self) => {
              // 返回第一个匹配项的索引，用于判断当前项是否为第一个匹配项
              const firstIndex = self.findIndex((obj) => obj.orderId === item.orderId);
              // 如果当前项是第一个匹配项，则保留，否则过滤掉
              return index === firstIndex;
            });
            this.customerorderListItem = uniqueDataList;

            this.loading = false;
            this.loading1 = false;
            this.openord = false;

            let num = 0;
            //计算订单总金额
            this.customerorderListItem.forEach(item => {
              num += parseFloat(item.officialAmount) ;
            });

            this.ddmoney = num.toFixed(2);
          });
        }


      },

    },


  };
</script>
<style>
  .el-table th.gutter {
    display: table-cell !important;
    /* 解决表头线未对齐 */
  }

  .jeclass .el-input__inner {
    text-align: right;
  }
</style>
<style lang="scss" module>
  .ElDialog {
    :global .el-dialog__body {
      padding: 1px !important;
    }
  }
</style>
